home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / By the Book / Learn C++ (CodeWarrior) / Chap 09.03 - nonVirtual / nonVirtual.cp < prev    next >
Text File  |  1995-10-21  |  778b  |  67 lines

  1. #include <iostream.h>
  2.  
  3.  
  4. //---------------------------------------  Root
  5.  
  6. class Root
  7. {
  8.     public:
  9.         Root();
  10. };
  11.  
  12. Root::Root()
  13. {
  14.     cout << "Root constructor called\n";
  15. }
  16.  
  17.  
  18. //---------------------------------------  Base1
  19.  
  20. class Base1 : public Root
  21. {
  22.     public:
  23.         Base1();
  24. };
  25.  
  26. Base1::Base1()
  27. {
  28.     cout << "Base1 constructor called\n";
  29. }
  30.  
  31.  
  32. //---------------------------------------  Base2
  33.  
  34. class Base2 : public Root
  35. {
  36.     public:
  37.         Base2();
  38. };
  39.  
  40. Base2::Base2()
  41. {
  42.     cout << "Base2 constructor called\n";
  43. }
  44.  
  45.  
  46. //---------------------------------------  Derived
  47.  
  48. class Derived : public Base1, public Base2
  49. {
  50.     public:
  51.         Derived();
  52. };
  53.  
  54. Derived::Derived()
  55. {
  56.     cout << "Derived constructor called\n";
  57. }
  58.  
  59.  
  60. //---------------------------------------  main()
  61.  
  62. int    main()
  63. {
  64.     Derived        myDerived;
  65.     
  66.     return 0;
  67. }